import Store from "../libs/wxminiSharedData.js";

/**
 * 全局状态管理
 */
export default new Store({
  data: {
    username: "登录/注册",
    head: "/public/images/default_avatar.png",
    isLogin: false,
  },
  getters: {
    getUserName: (data) => {
      return data.username;
    },
    getHead: (data) => {
      return data.head;
    },
    getIsLogin: (data) => {
      return data.isLogin;
    }
  },
  mutations: {
    setUserName: (data, username) => {
      data.username = username;
    },
    setHead: (data, head) => {
      data.head = head;
    },
    setIsLogin: (data, isLogin) => {
      data.isLogin = isLogin;
    }
  },
  actions: {}
});